package com.htl.线程;

public class Test2 {
    public static void main(String[] args) {
        JoinRunnbale joinRunnbale = new JoinRunnbale();
        Thread thread = new Thread(joinRunnbale);
        thread.start();
        for (int i = 0; i < 100; i++) {
            if(i == 20){
                try {
//                    thread.join();
                    thread.join(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(i + "+++++++++++++++main");
        }
    }
}

/**
 * 任务类
 */
class JoinRunnbale implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(i + "-----------------JoinRunnable");
        }
    }
}
